<!DOCTYPE html>
<html lang="en">

	<head>
		<meta charset="utf-8">
		<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
		<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
		<meta http-equiv="X-UA-Compatible" content="IE=8">
		<title>意见反馈</title>
		<link rel="stylesheet" href="../../bootstrap/css/bootstrap.min.css">
		<link rel="stylesheet" href="../../layui/css/layui.css">
		<link rel="stylesheet" href="../../css/default.css">
		<link rel="stylesheet" href="../../css/swiper.min.css">
		<link rel="stylesheet" href="../../css/common.css">
		<link rel="stylesheet" href="../../css/style.css">
		<link rel="stylesheet" type="text/css" href="css/feedback.css" />
	</head>

	<body>
		<div class="top_header_wrap"></div>
		<!--#include file="../common/header.html" -->
		<!--广告-->
		<div class="banner">
			<div class="swiper-container swiper-container1">
				<div class="swiper-wrapper">
					<div class="swiper-slide"><img src="../../img/banner.jpg"></div>
					<div class="swiper-slide"><img src="../../img/banner.jpg"></div>
					<div class="swiper-slide"><img src="../../img/banner.jpg"></div>
				</div>
				<!-- Add Pagination -->
				<div class="swiper-pagination"></div>
			</div>
		</div>
		<!--内容-->
		<div class="main_container">
			<!-- 标题 -->
			<div class="main_title layui-row">
				<div class="layui-col-md3 layui-col-xs2">&nbsp;</div>
				<div class="main_text layui-col-md4 layui-col-xs8">个人中心&gt;意见反馈</div>
			</div>
			<!-- 内容 -->
			<div class="main_content layui-row">
				<div class="content1 layui-col-md4 layui-col-xs2">&nbsp;</div>
				<div class="content2 layui-col-md4 layui-col-xs8">
					<div class="feedback layui-row">
						<div class="feedback_tea layui-col-md12 layui-col-xs12">
							<textarea name="content" id="content" onkeyup="cal();" maxlength="200" onpropertychange="if(value.length>200) value=value.substr(0,200)" placeholder="请输入反馈内容，我们会为您更好的服务"></textarea>
							<span id="msg_span"></span>
						</div>
						<div class="layui-col-md12" style="text-align: right;"><span class="text_count"><span id="text_num">0</span>/<span class="num_count" id="numCount">200</span>字</span>
						</div>
						<div class="feedback_img layui-col-md3 layui-col-xs3">
							<input type="file" id="feedback_img" class="feedback_img_input"/>
							<img src="../../img/feedback.png" >
						</div>
					</div>
					<div class="feedback_btn layui-row">
						<div class="btn1 layui-col-md4 layui-col-xs4">&nbsp;</div>
						<div class="btn layui-col-md8 layui-col-xs8" id="submit_feedback">提交反馈</div>
						<div class="btn2 layui-col-md4 layui-col-xs4">&nbsp;</div>
					</div>
				</div>
				<div class="content3 layui-col-md4 layui-col-xs2">&nbsp;</div>
			</div>
		</div>
		<!--尾部-->
		<div class="footer_container">

		</div>
		</div>
		<!-- js -->
		<script src="../../js/jquery-1.11.0.min.js"></script>
		<script type="text/javascript" src="../../layui/layui.all.js"></script>
		<script type="text/javascript" src="../../js/swiper.min.js"></script>
		<script type="text/javascript" src="../../js/cookieUtils.js"></script>
		<script type="text/javascript" src="../../bootstrap/js/bootstrap.min.js"></script>
		<script>
			function cal() {

				   
				var length = $("#content").val().length;   
				if(length > 200) {     
						$("#talkCount").text(length);   
					} else {     
						$("#numCount").text(200 - length);
						$("#text_num").text(length)    
					}  
			}

			$('#submit_feedback').click(function(){
				var textCon = $('#content').val();
				var feedback_img = $('#feedback_img')[0].files[0];
				var userId = GetCookie("userId");
				var formData=new FormData();
				formData.append("user_id","1df838d2760a11e991d30c96e6d7103a");
				formData.append("feedcontent", textCon)
				formData.append("image", feedback_img);
				if(textCon == null || textCon == '') {
					$('#msg_span').html("请输入内容或上传图片");
					$('#msg_span').show();
					return;
				}
				$.ajax({
					type: "POST",
					url: "http://47.111.188.27:8080/gsgkzyl/mine/feedback",
					data: formData,
					contentType: false,
					processData:false,
					success: function(fb) {
						console.log(fb)
						if(fb.status == 0) {
							layer.alert('提交反馈成功', function() {
								window.location.href = "../personal_center/profile.html"
							})
						}
					}
				});
			});

			$(document).ready(function() {
				$(".top_header_wrap").load("../common/header.html");
				$(".footer_container").load("../common/footer.html");
			})
		</script>
	</body>

</html>